package com.cheer.controller;

import com.cheer.common.Result;
import com.cheer.service.AuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;


/**
 * @author cheer
 */
@RestController
@RequestMapping("/auth")
public class AuthController {

    @Autowired
    private AuthService authService;

    @GetMapping("/login")
    public Result login(@RequestParam String code, HttpSession session) {
        authService.login(code, session);
        return Result.success();
    }

    @GetMapping("/share")
    public Result share(@RequestParam String url) {
        return Result.success(authService.share(url));
    }

}
